package com.greenlife.controller.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class HttpUtil {
	
	/**
	 * 将InputStream转换成string
	 * @param is
	 * @return 
	 * @throws Exception
	 */
	public static String streamChangeToString(InputStream is) throws Exception{
		String result=null;
		InputStreamReader isr = new InputStreamReader(is,"UTF-8");			
		BufferedReader br = new BufferedReader(isr);
		StringBuilder builder = new StringBuilder();
	    String line="";
		while ((line = br.readLine()) != null) {
		   builder.append(line);
		}
		result = builder.toString();
		br.close();
		isr.close();		  
	    return result;
	}

}
